package com.test.springbootweb.Pojo;

public class Result {
    //响应码 1 代表成功，0 代表失败
    private  Integer code;
    //返回数据
    private  Object  data;
    //提示信息
    private  String  msg;

    public Result(Integer code, Object data, String msg) {
        this.code = code;
        this.data = data;
        this.msg  =  msg;
    }

    public Result() {
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toString() {
        return "Result{" +
                "code=" + code +
                ", data=" + data +
                ", msg='" + msg + '\'' +
                '}';
    }
    public static Result success(Object data){
        return new Result(1,"data","success");
    }
    public static Result success(){
        return new Result( 1,"null","success");
    }
    public static Result error(String msg){
        return new Result(0,"null","error");
    }
}
